<template>
  <div class="box">
    <el-form label-width="80px">
      <el-form-item label="活动名称">
        <s-validate #default="{ validate }" :rules="rules" :value="value">
          <el-input v-model="value" @blur="validate" />
        </s-validate>
      </el-form-item>
      <el-form-item label="活动区域">
        <el-select placeholder="请选择活动区域">
          <el-option label="区域一" value="shanghai" />
          <el-option label="区域二" value="beijing" />
        </el-select>
      </el-form-item>
      <el-form-item label="活动时间">
        <el-col :span="11">
          <el-date-picker type="date" placeholder="选择日期" style="width: 100%;" />
        </el-col>
        <el-col class="line" :span="2">-</el-col>
        <el-col :span="11">
          <el-time-picker placeholder="选择时间" style="width: 100%;" />
        </el-col>
      </el-form-item>
      <el-form-item label="即时配送">
        <el-switch />
      </el-form-item>
      <el-form-item label="活动性质">
        <el-checkbox-group v-model="type">
          <el-checkbox label="美食/餐厅线上活动" name="type" />
          <el-checkbox label="地推活动" name="type" />
          <el-checkbox label="线下主题活动" name="type" />
          <el-checkbox label="单纯品牌曝光" name="type" />
        </el-checkbox-group>
      </el-form-item>
      <el-form-item label="特殊资源">
        <el-radio-group>
          <el-radio label="线上品牌商赞助" />
          <el-radio label="线下场地免费" />
        </el-radio-group>
      </el-form-item>
      <el-form-item label="活动形式">
        <s-validate #default="{ validate }" :rules="textRules" :value="value2">
          <el-input v-model="value2" type="textarea" @blur="validate" />
        </s-validate>
      </el-form-item>
      <el-form-item>
        <el-button type="primary">立即创建</el-button>
        <el-button>取消</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
import SValidate from './svalidate.vue'
export default {
  name: 'Renderless',
  components: {
    SValidate
  },
  data() {
    return {
      type: [],
      value: '',
      rules: [{
        test: function(value) {
          return /\d+/.test(value)
        },
        message: '请输入一个数字'
      }],
      textRules: [{
        test: function(value) {
          return value
        },
        message: '请输入内容'
      }]
    }
  }
}
</script>

<style scoped>
  .box{
    margin-top: 20px;
    width:400px;
  }
</style>
